package com.lee.single.controller;

import com.lee.single.util.CommonUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Lee
 * @date 2020/8/17
 */
@RestController
@RequestMapping("env")
public class EnvController {

    @GetMapping("info")
    public Map<String, Object> info(HttpServletRequest request){

        Map<String, Object> infos = new HashMap<>(5);

        infos.put("time", LocalDateTime.now());
        infos.put("ip", CommonUtils.getCliectIp(request));

        return infos;
    }
}
